﻿namespace N2.Workflow.Items
{
	using Web;
	
	partial class ItemState: IItemState, ILink
	{
// TODO inject as an external dependency
		protected IWorkflowProvider Provider {
			get { return Context.Current.Resolve<IWorkflowProvider>(); }
		}

		public ContentItem EnclosingItem { get { return this.Parent; } }

		#region ILink Members

		public string Target { get { return string.Empty; } }

		public string ToolTip {
			get {
				return string.Format(
						"{2} on {0} by {1}",
						this.Updated,
						this.SavedBy,
						this.Action != null ? this.Action.Name : "?");
			}
		}

		#endregion

		#region IItemState Members

		ContentItem IItemState.EnclosingItem {
			get { return this.EnclosingItem; }
		}

		IStateDefinition IItemState.Definition {
			get { return this.Definition as IStateDefinition; }
		}

		IActionDefinition IItemState.Action {
			get { return this.Action as IActionDefinition; }
		}

		IItemState IItemState.PreviousState {
			get { return this.PreviousState as IItemState; }
		}

		#endregion
	}
}
